package dao;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;


/**
 * This class was autogenerated by Torque on:
 *
 * [Fri Jan 09 02:39:32 PST 2009]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Course
 */
public abstract class BaseCourse extends BaseObject
{
    /** The Peer class */
    private static final CoursePeer peer =
        new CoursePeer();

        
    /** The value for the courseid field */
    private int courseid;
      
    /** The value for the coursecode field */
    private String coursecode;
      
    /** The value for the coursename field */
    private String coursename;
      
    /** The value for the coursedescription field */
    private String coursedescription;
      
    /** The value for the credit field */
    private int credit;
      
    /** The value for the type field */
    private String type;
      
    /** The value for the coursestatus field */
    private int coursestatus;
  
    
    /**
     * Get the Courseid
     *
     * @return int
     */
    public int getCourseid()
    {
        return courseid;
    }

                                              
    /**
     * Set the value of Courseid
     *
     * @param v new value
     */
    public void setCourseid(int v) throws TorqueException
    {
    
                  if (this.courseid != v)
              {
            this.courseid = v;
            setModified(true);
        }
    
          
                                  
        // update associated CourseSemesterOffered
        if (collCourseSemesterOffereds != null)
        {
            for (int i = 0; i < collCourseSemesterOffereds.size(); i++)
            {
                ((CourseSemesterOffered) collCourseSemesterOffereds.get(i))
                    .setCourseid(v);
            }
        }
                                          
        // update associated CourseRgepDomain
        if (collCourseRgepDomains != null)
        {
            for (int i = 0; i < collCourseRgepDomains.size(); i++)
            {
                ((CourseRgepDomain) collCourseRgepDomains.get(i))
                    .setCourseid(v);
            }
        }
                                          
        // update associated CourseLecture
        if (collCourseLectures != null)
        {
            for (int i = 0; i < collCourseLectures.size(); i++)
            {
                ((CourseLecture) collCourseLectures.get(i))
                    .setCourseid(v);
            }
        }
                                          
        // update associated CourseLaboratory
        if (collCourseLaboratorys != null)
        {
            for (int i = 0; i < collCourseLaboratorys.size(); i++)
            {
                ((CourseLaboratory) collCourseLaboratorys.get(i))
                    .setCourseid(v);
            }
        }
                                          
        // update associated CourseOfferingUnit
        if (collCourseOfferingUnits != null)
        {
            for (int i = 0; i < collCourseOfferingUnits.size(); i++)
            {
                ((CourseOfferingUnit) collCourseOfferingUnits.get(i))
                    .setCourseid(v);
            }
        }
                                          
        // update associated CourseEquivalencies
        if (collCourseEquivalenciessRelatedByCourseid != null)
        {
            for (int i = 0; i < collCourseEquivalenciessRelatedByCourseid.size(); i++)
            {
                ((CourseEquivalencies) collCourseEquivalenciessRelatedByCourseid.get(i))
                    .setCourseid(v);
            }
        }
                                          
        // update associated CourseEquivalencies
        if (collCourseEquivalenciessRelatedByCourseequivalencies != null)
        {
            for (int i = 0; i < collCourseEquivalenciessRelatedByCourseequivalencies.size(); i++)
            {
                ((CourseEquivalencies) collCourseEquivalenciessRelatedByCourseequivalencies.get(i))
                    .setCourseequivalencies(v);
            }
        }
                                          
        // update associated Grade
        if (collGrades != null)
        {
            for (int i = 0; i < collGrades.size(); i++)
            {
                ((Grade) collGrades.get(i))
                    .setCourseid(v);
            }
        }
                                          
        // update associated Section
        if (collSections != null)
        {
            for (int i = 0; i < collSections.size(); i++)
            {
                ((Section) collSections.get(i))
                    .setCourseid(v);
            }
        }
                      }
  
    /**
     * Get the Coursecode
     *
     * @return String
     */
    public String getCoursecode()
    {
        return coursecode;
    }

                        
    /**
     * Set the value of Coursecode
     *
     * @param v new value
     */
    public void setCoursecode(String v) 
    {
    
                  if (!ObjectUtils.equals(this.coursecode, v))
              {
            this.coursecode = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Coursename
     *
     * @return String
     */
    public String getCoursename()
    {
        return coursename;
    }

                        
    /**
     * Set the value of Coursename
     *
     * @param v new value
     */
    public void setCoursename(String v) 
    {
    
                  if (!ObjectUtils.equals(this.coursename, v))
              {
            this.coursename = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Coursedescription
     *
     * @return String
     */
    public String getCoursedescription()
    {
        return coursedescription;
    }

                        
    /**
     * Set the value of Coursedescription
     *
     * @param v new value
     */
    public void setCoursedescription(String v) 
    {
    
                  if (!ObjectUtils.equals(this.coursedescription, v))
              {
            this.coursedescription = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Credit
     *
     * @return int
     */
    public int getCredit()
    {
        return credit;
    }

                        
    /**
     * Set the value of Credit
     *
     * @param v new value
     */
    public void setCredit(int v) 
    {
    
                  if (this.credit != v)
              {
            this.credit = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Type
     *
     * @return String
     */
    public String getType()
    {
        return type;
    }

                        
    /**
     * Set the value of Type
     *
     * @param v new value
     */
    public void setType(String v) 
    {
    
                  if (!ObjectUtils.equals(this.type, v))
              {
            this.type = v;
            setModified(true);
        }
    
          
              }
  
    /**
     * Get the Coursestatus
     *
     * @return int
     */
    public int getCoursestatus()
    {
        return coursestatus;
    }

                        
    /**
     * Set the value of Coursestatus
     *
     * @param v new value
     */
    public void setCoursestatus(int v) 
    {
    
                  if (this.coursestatus != v)
              {
            this.coursestatus = v;
            setModified(true);
        }
    
          
              }
  
         
                                
            
    /**
     * Collection to store aggregation of collCourseSemesterOffereds
     */
    protected List collCourseSemesterOffereds;

    /**
     * Temporary storage of collCourseSemesterOffereds to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCourseSemesterOffereds()
    {
        if (collCourseSemesterOffereds == null)
        {
            collCourseSemesterOffereds = new ArrayList();
        }
    }

    /**
     * Method called to associate a CourseSemesterOffered object to this object
     * through the CourseSemesterOffered foreign key attribute
     *
     * @param l CourseSemesterOffered
     * @throws TorqueException
     */
    public void addCourseSemesterOffered(CourseSemesterOffered l) throws TorqueException
    {
        getCourseSemesterOffereds().add(l);
        l.setCourse((Course) this);
    }

    /**
     * The criteria used to select the current contents of collCourseSemesterOffereds
     */
    private Criteria lastCourseSemesterOfferedsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseSemesterOffereds(new Criteria())
     *
     * @throws TorqueException
     */
    public List getCourseSemesterOffereds() throws TorqueException
    {
        if (collCourseSemesterOffereds == null)
        {
            collCourseSemesterOffereds = getCourseSemesterOffereds(new Criteria(10));
        }
        return collCourseSemesterOffereds;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseSemesterOffereds from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCourseSemesterOffereds(Criteria criteria) throws TorqueException
    {
        if (collCourseSemesterOffereds == null)
        {
            if (isNew())
            {
               collCourseSemesterOffereds = new ArrayList();
            }
            else
            {
                      criteria.add(CourseSemesterOfferedPeer.COURSEID, getCourseid() );
                      collCourseSemesterOffereds = CourseSemesterOfferedPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(CourseSemesterOfferedPeer.COURSEID, getCourseid());
                      if (!lastCourseSemesterOfferedsCriteria.equals(criteria))
                {
                    collCourseSemesterOffereds = CourseSemesterOfferedPeer.doSelect(criteria);
                }
            }
        }
        lastCourseSemesterOfferedsCriteria = criteria;

        return collCourseSemesterOffereds;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseSemesterOffereds(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseSemesterOffereds(Connection con) throws TorqueException
    {
        if (collCourseSemesterOffereds == null)
        {
            collCourseSemesterOffereds = getCourseSemesterOffereds(new Criteria(10), con);
        }
        return collCourseSemesterOffereds;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseSemesterOffereds from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseSemesterOffereds(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCourseSemesterOffereds == null)
        {
            if (isNew())
            {
               collCourseSemesterOffereds = new ArrayList();
            }
            else
            {
                       criteria.add(CourseSemesterOfferedPeer.COURSEID, getCourseid());
                       collCourseSemesterOffereds = CourseSemesterOfferedPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(CourseSemesterOfferedPeer.COURSEID, getCourseid());
                       if (!lastCourseSemesterOfferedsCriteria.equals(criteria))
                 {
                     collCourseSemesterOffereds = CourseSemesterOfferedPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCourseSemesterOfferedsCriteria = criteria;

         return collCourseSemesterOffereds;
     }

                  
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseSemesterOffereds from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseSemesterOfferedsJoinCourse(Criteria criteria)
        throws TorqueException
    {
        if (collCourseSemesterOffereds == null)
        {
            if (isNew())
            {
               collCourseSemesterOffereds = new ArrayList();
            }
            else
            {
                            criteria.add(CourseSemesterOfferedPeer.COURSEID, getCourseid());
                            collCourseSemesterOffereds = CourseSemesterOfferedPeer.doSelectJoinCourse(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseSemesterOfferedPeer.COURSEID, getCourseid());
                        if (!lastCourseSemesterOfferedsCriteria.equals(criteria))
            {
                collCourseSemesterOffereds = CourseSemesterOfferedPeer.doSelectJoinCourse(criteria);
            }
        }
        lastCourseSemesterOfferedsCriteria = criteria;

        return collCourseSemesterOffereds;
    }
                            


                          
            
    /**
     * Collection to store aggregation of collCourseRgepDomains
     */
    protected List collCourseRgepDomains;

    /**
     * Temporary storage of collCourseRgepDomains to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCourseRgepDomains()
    {
        if (collCourseRgepDomains == null)
        {
            collCourseRgepDomains = new ArrayList();
        }
    }

    /**
     * Method called to associate a CourseRgepDomain object to this object
     * through the CourseRgepDomain foreign key attribute
     *
     * @param l CourseRgepDomain
     * @throws TorqueException
     */
    public void addCourseRgepDomain(CourseRgepDomain l) throws TorqueException
    {
        getCourseRgepDomains().add(l);
        l.setCourse((Course) this);
    }

    /**
     * The criteria used to select the current contents of collCourseRgepDomains
     */
    private Criteria lastCourseRgepDomainsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseRgepDomains(new Criteria())
     *
     * @throws TorqueException
     */
    public List getCourseRgepDomains() throws TorqueException
    {
        if (collCourseRgepDomains == null)
        {
            collCourseRgepDomains = getCourseRgepDomains(new Criteria(10));
        }
        return collCourseRgepDomains;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseRgepDomains from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCourseRgepDomains(Criteria criteria) throws TorqueException
    {
        if (collCourseRgepDomains == null)
        {
            if (isNew())
            {
               collCourseRgepDomains = new ArrayList();
            }
            else
            {
                      criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid() );
                      collCourseRgepDomains = CourseRgepDomainPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid());
                      if (!lastCourseRgepDomainsCriteria.equals(criteria))
                {
                    collCourseRgepDomains = CourseRgepDomainPeer.doSelect(criteria);
                }
            }
        }
        lastCourseRgepDomainsCriteria = criteria;

        return collCourseRgepDomains;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseRgepDomains(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseRgepDomains(Connection con) throws TorqueException
    {
        if (collCourseRgepDomains == null)
        {
            collCourseRgepDomains = getCourseRgepDomains(new Criteria(10), con);
        }
        return collCourseRgepDomains;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseRgepDomains from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseRgepDomains(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCourseRgepDomains == null)
        {
            if (isNew())
            {
               collCourseRgepDomains = new ArrayList();
            }
            else
            {
                       criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid());
                       collCourseRgepDomains = CourseRgepDomainPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid());
                       if (!lastCourseRgepDomainsCriteria.equals(criteria))
                 {
                     collCourseRgepDomains = CourseRgepDomainPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCourseRgepDomainsCriteria = criteria;

         return collCourseRgepDomains;
     }

                        
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseRgepDomains from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseRgepDomainsJoinCourse(Criteria criteria)
        throws TorqueException
    {
        if (collCourseRgepDomains == null)
        {
            if (isNew())
            {
               collCourseRgepDomains = new ArrayList();
            }
            else
            {
                            criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid());
                            collCourseRgepDomains = CourseRgepDomainPeer.doSelectJoinCourse(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid());
                        if (!lastCourseRgepDomainsCriteria.equals(criteria))
            {
                collCourseRgepDomains = CourseRgepDomainPeer.doSelectJoinCourse(criteria);
            }
        }
        lastCourseRgepDomainsCriteria = criteria;

        return collCourseRgepDomains;
    }
                  
                    
                    
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseRgepDomains from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseRgepDomainsJoinRgepDomain(Criteria criteria)
        throws TorqueException
    {
        if (collCourseRgepDomains == null)
        {
            if (isNew())
            {
               collCourseRgepDomains = new ArrayList();
            }
            else
            {
                            criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid());
                            collCourseRgepDomains = CourseRgepDomainPeer.doSelectJoinRgepDomain(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseRgepDomainPeer.COURSEID, getCourseid());
                        if (!lastCourseRgepDomainsCriteria.equals(criteria))
            {
                collCourseRgepDomains = CourseRgepDomainPeer.doSelectJoinRgepDomain(criteria);
            }
        }
        lastCourseRgepDomainsCriteria = criteria;

        return collCourseRgepDomains;
    }
                            


                          
            
    /**
     * Collection to store aggregation of collCourseLectures
     */
    protected List collCourseLectures;

    /**
     * Temporary storage of collCourseLectures to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCourseLectures()
    {
        if (collCourseLectures == null)
        {
            collCourseLectures = new ArrayList();
        }
    }

    /**
     * Method called to associate a CourseLecture object to this object
     * through the CourseLecture foreign key attribute
     *
     * @param l CourseLecture
     * @throws TorqueException
     */
    public void addCourseLecture(CourseLecture l) throws TorqueException
    {
        getCourseLectures().add(l);
        l.setCourse((Course) this);
    }

    /**
     * The criteria used to select the current contents of collCourseLectures
     */
    private Criteria lastCourseLecturesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseLectures(new Criteria())
     *
     * @throws TorqueException
     */
    public List getCourseLectures() throws TorqueException
    {
        if (collCourseLectures == null)
        {
            collCourseLectures = getCourseLectures(new Criteria(10));
        }
        return collCourseLectures;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseLectures from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCourseLectures(Criteria criteria) throws TorqueException
    {
        if (collCourseLectures == null)
        {
            if (isNew())
            {
               collCourseLectures = new ArrayList();
            }
            else
            {
                      criteria.add(CourseLecturePeer.COURSEID, getCourseid() );
                      collCourseLectures = CourseLecturePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(CourseLecturePeer.COURSEID, getCourseid());
                      if (!lastCourseLecturesCriteria.equals(criteria))
                {
                    collCourseLectures = CourseLecturePeer.doSelect(criteria);
                }
            }
        }
        lastCourseLecturesCriteria = criteria;

        return collCourseLectures;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseLectures(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseLectures(Connection con) throws TorqueException
    {
        if (collCourseLectures == null)
        {
            collCourseLectures = getCourseLectures(new Criteria(10), con);
        }
        return collCourseLectures;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseLectures from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseLectures(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCourseLectures == null)
        {
            if (isNew())
            {
               collCourseLectures = new ArrayList();
            }
            else
            {
                       criteria.add(CourseLecturePeer.COURSEID, getCourseid());
                       collCourseLectures = CourseLecturePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(CourseLecturePeer.COURSEID, getCourseid());
                       if (!lastCourseLecturesCriteria.equals(criteria))
                 {
                     collCourseLectures = CourseLecturePeer.doSelect(criteria, con);
                 }
             }
         }
         lastCourseLecturesCriteria = criteria;

         return collCourseLectures;
     }

                  
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseLectures from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseLecturesJoinCourse(Criteria criteria)
        throws TorqueException
    {
        if (collCourseLectures == null)
        {
            if (isNew())
            {
               collCourseLectures = new ArrayList();
            }
            else
            {
                            criteria.add(CourseLecturePeer.COURSEID, getCourseid());
                            collCourseLectures = CourseLecturePeer.doSelectJoinCourse(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseLecturePeer.COURSEID, getCourseid());
                        if (!lastCourseLecturesCriteria.equals(criteria))
            {
                collCourseLectures = CourseLecturePeer.doSelectJoinCourse(criteria);
            }
        }
        lastCourseLecturesCriteria = criteria;

        return collCourseLectures;
    }
                            


                          
            
    /**
     * Collection to store aggregation of collCourseLaboratorys
     */
    protected List collCourseLaboratorys;

    /**
     * Temporary storage of collCourseLaboratorys to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCourseLaboratorys()
    {
        if (collCourseLaboratorys == null)
        {
            collCourseLaboratorys = new ArrayList();
        }
    }

    /**
     * Method called to associate a CourseLaboratory object to this object
     * through the CourseLaboratory foreign key attribute
     *
     * @param l CourseLaboratory
     * @throws TorqueException
     */
    public void addCourseLaboratory(CourseLaboratory l) throws TorqueException
    {
        getCourseLaboratorys().add(l);
        l.setCourse((Course) this);
    }

    /**
     * The criteria used to select the current contents of collCourseLaboratorys
     */
    private Criteria lastCourseLaboratorysCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseLaboratorys(new Criteria())
     *
     * @throws TorqueException
     */
    public List getCourseLaboratorys() throws TorqueException
    {
        if (collCourseLaboratorys == null)
        {
            collCourseLaboratorys = getCourseLaboratorys(new Criteria(10));
        }
        return collCourseLaboratorys;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseLaboratorys from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCourseLaboratorys(Criteria criteria) throws TorqueException
    {
        if (collCourseLaboratorys == null)
        {
            if (isNew())
            {
               collCourseLaboratorys = new ArrayList();
            }
            else
            {
                      criteria.add(CourseLaboratoryPeer.COURSEID, getCourseid() );
                      collCourseLaboratorys = CourseLaboratoryPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(CourseLaboratoryPeer.COURSEID, getCourseid());
                      if (!lastCourseLaboratorysCriteria.equals(criteria))
                {
                    collCourseLaboratorys = CourseLaboratoryPeer.doSelect(criteria);
                }
            }
        }
        lastCourseLaboratorysCriteria = criteria;

        return collCourseLaboratorys;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseLaboratorys(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseLaboratorys(Connection con) throws TorqueException
    {
        if (collCourseLaboratorys == null)
        {
            collCourseLaboratorys = getCourseLaboratorys(new Criteria(10), con);
        }
        return collCourseLaboratorys;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseLaboratorys from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseLaboratorys(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCourseLaboratorys == null)
        {
            if (isNew())
            {
               collCourseLaboratorys = new ArrayList();
            }
            else
            {
                       criteria.add(CourseLaboratoryPeer.COURSEID, getCourseid());
                       collCourseLaboratorys = CourseLaboratoryPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(CourseLaboratoryPeer.COURSEID, getCourseid());
                       if (!lastCourseLaboratorysCriteria.equals(criteria))
                 {
                     collCourseLaboratorys = CourseLaboratoryPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCourseLaboratorysCriteria = criteria;

         return collCourseLaboratorys;
     }

                  
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseLaboratorys from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseLaboratorysJoinCourse(Criteria criteria)
        throws TorqueException
    {
        if (collCourseLaboratorys == null)
        {
            if (isNew())
            {
               collCourseLaboratorys = new ArrayList();
            }
            else
            {
                            criteria.add(CourseLaboratoryPeer.COURSEID, getCourseid());
                            collCourseLaboratorys = CourseLaboratoryPeer.doSelectJoinCourse(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseLaboratoryPeer.COURSEID, getCourseid());
                        if (!lastCourseLaboratorysCriteria.equals(criteria))
            {
                collCourseLaboratorys = CourseLaboratoryPeer.doSelectJoinCourse(criteria);
            }
        }
        lastCourseLaboratorysCriteria = criteria;

        return collCourseLaboratorys;
    }
                            


                          
            
    /**
     * Collection to store aggregation of collCourseOfferingUnits
     */
    protected List collCourseOfferingUnits;

    /**
     * Temporary storage of collCourseOfferingUnits to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCourseOfferingUnits()
    {
        if (collCourseOfferingUnits == null)
        {
            collCourseOfferingUnits = new ArrayList();
        }
    }

    /**
     * Method called to associate a CourseOfferingUnit object to this object
     * through the CourseOfferingUnit foreign key attribute
     *
     * @param l CourseOfferingUnit
     * @throws TorqueException
     */
    public void addCourseOfferingUnit(CourseOfferingUnit l) throws TorqueException
    {
        getCourseOfferingUnits().add(l);
        l.setCourse((Course) this);
    }

    /**
     * The criteria used to select the current contents of collCourseOfferingUnits
     */
    private Criteria lastCourseOfferingUnitsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseOfferingUnits(new Criteria())
     *
     * @throws TorqueException
     */
    public List getCourseOfferingUnits() throws TorqueException
    {
        if (collCourseOfferingUnits == null)
        {
            collCourseOfferingUnits = getCourseOfferingUnits(new Criteria(10));
        }
        return collCourseOfferingUnits;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseOfferingUnits from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCourseOfferingUnits(Criteria criteria) throws TorqueException
    {
        if (collCourseOfferingUnits == null)
        {
            if (isNew())
            {
               collCourseOfferingUnits = new ArrayList();
            }
            else
            {
                      criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid() );
                      collCourseOfferingUnits = CourseOfferingUnitPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid());
                      if (!lastCourseOfferingUnitsCriteria.equals(criteria))
                {
                    collCourseOfferingUnits = CourseOfferingUnitPeer.doSelect(criteria);
                }
            }
        }
        lastCourseOfferingUnitsCriteria = criteria;

        return collCourseOfferingUnits;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseOfferingUnits(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseOfferingUnits(Connection con) throws TorqueException
    {
        if (collCourseOfferingUnits == null)
        {
            collCourseOfferingUnits = getCourseOfferingUnits(new Criteria(10), con);
        }
        return collCourseOfferingUnits;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseOfferingUnits from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseOfferingUnits(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCourseOfferingUnits == null)
        {
            if (isNew())
            {
               collCourseOfferingUnits = new ArrayList();
            }
            else
            {
                       criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid());
                       collCourseOfferingUnits = CourseOfferingUnitPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid());
                       if (!lastCourseOfferingUnitsCriteria.equals(criteria))
                 {
                     collCourseOfferingUnits = CourseOfferingUnitPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCourseOfferingUnitsCriteria = criteria;

         return collCourseOfferingUnits;
     }

                        
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseOfferingUnits from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseOfferingUnitsJoinCourse(Criteria criteria)
        throws TorqueException
    {
        if (collCourseOfferingUnits == null)
        {
            if (isNew())
            {
               collCourseOfferingUnits = new ArrayList();
            }
            else
            {
                            criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid());
                            collCourseOfferingUnits = CourseOfferingUnitPeer.doSelectJoinCourse(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid());
                        if (!lastCourseOfferingUnitsCriteria.equals(criteria))
            {
                collCourseOfferingUnits = CourseOfferingUnitPeer.doSelectJoinCourse(criteria);
            }
        }
        lastCourseOfferingUnitsCriteria = criteria;

        return collCourseOfferingUnits;
    }
                  
                    
                    
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseOfferingUnits from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseOfferingUnitsJoinUnit(Criteria criteria)
        throws TorqueException
    {
        if (collCourseOfferingUnits == null)
        {
            if (isNew())
            {
               collCourseOfferingUnits = new ArrayList();
            }
            else
            {
                            criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid());
                            collCourseOfferingUnits = CourseOfferingUnitPeer.doSelectJoinUnit(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseOfferingUnitPeer.COURSEID, getCourseid());
                        if (!lastCourseOfferingUnitsCriteria.equals(criteria))
            {
                collCourseOfferingUnits = CourseOfferingUnitPeer.doSelectJoinUnit(criteria);
            }
        }
        lastCourseOfferingUnitsCriteria = criteria;

        return collCourseOfferingUnits;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collCourseEquivalenciessRelatedByCourseid
     */
    protected List collCourseEquivalenciessRelatedByCourseid;

    /**
     * Temporary storage of collCourseEquivalenciessRelatedByCourseid to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCourseEquivalenciessRelatedByCourseid()
    {
        if (collCourseEquivalenciessRelatedByCourseid == null)
        {
            collCourseEquivalenciessRelatedByCourseid = new ArrayList();
        }
    }

    /**
     * Method called to associate a CourseEquivalencies object to this object
     * through the CourseEquivalencies foreign key attribute
     *
     * @param l CourseEquivalencies
     * @throws TorqueException
     */
    public void addCourseEquivalenciesRelatedByCourseid(CourseEquivalencies l) throws TorqueException
    {
        getCourseEquivalenciessRelatedByCourseid().add(l);
        l.setCourseRelatedByCourseid((Course) this);
    }

    /**
     * The criteria used to select the current contents of collCourseEquivalenciessRelatedByCourseid
     */
    private Criteria lastCourseEquivalenciessRelatedByCourseidCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseEquivalenciessRelatedByCourseid(new Criteria())
     *
     * @throws TorqueException
     */
    public List getCourseEquivalenciessRelatedByCourseid() throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseid == null)
        {
            collCourseEquivalenciessRelatedByCourseid = getCourseEquivalenciessRelatedByCourseid(new Criteria(10));
        }
        return collCourseEquivalenciessRelatedByCourseid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseEquivalenciessRelatedByCourseid from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCourseEquivalenciessRelatedByCourseid(Criteria criteria) throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseid == null)
        {
            if (isNew())
            {
               collCourseEquivalenciessRelatedByCourseid = new ArrayList();
            }
            else
            {
                      criteria.add(CourseEquivalenciesPeer.COURSEID, getCourseid() );
                      collCourseEquivalenciessRelatedByCourseid = CourseEquivalenciesPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(CourseEquivalenciesPeer.COURSEID, getCourseid());
                      if (!lastCourseEquivalenciessRelatedByCourseidCriteria.equals(criteria))
                {
                    collCourseEquivalenciessRelatedByCourseid = CourseEquivalenciesPeer.doSelect(criteria);
                }
            }
        }
        lastCourseEquivalenciessRelatedByCourseidCriteria = criteria;

        return collCourseEquivalenciessRelatedByCourseid;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseEquivalenciessRelatedByCourseid(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseEquivalenciessRelatedByCourseid(Connection con) throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseid == null)
        {
            collCourseEquivalenciessRelatedByCourseid = getCourseEquivalenciessRelatedByCourseid(new Criteria(10), con);
        }
        return collCourseEquivalenciessRelatedByCourseid;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseEquivalenciessRelatedByCourseid from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseEquivalenciessRelatedByCourseid(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseid == null)
        {
            if (isNew())
            {
               collCourseEquivalenciessRelatedByCourseid = new ArrayList();
            }
            else
            {
                       criteria.add(CourseEquivalenciesPeer.COURSEID, getCourseid());
                       collCourseEquivalenciessRelatedByCourseid = CourseEquivalenciesPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(CourseEquivalenciesPeer.COURSEID, getCourseid());
                       if (!lastCourseEquivalenciessRelatedByCourseidCriteria.equals(criteria))
                 {
                     collCourseEquivalenciessRelatedByCourseid = CourseEquivalenciesPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCourseEquivalenciessRelatedByCourseidCriteria = criteria;

         return collCourseEquivalenciessRelatedByCourseid;
     }

                        
              
                    
                              
                                            
                                                                          
                                        
                    
                                            
                  
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseEquivalenciessRelatedByCourseid from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseEquivalenciessRelatedByCourseidJoinCourseRelatedByCourseequivalencies(Criteria criteria)
        throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseid == null)
        {
            if (isNew())
            {
               collCourseEquivalenciessRelatedByCourseid = new ArrayList();
            }
            else
            {
                            criteria.add(CourseEquivalenciesPeer.COURSEID, getCourseid());
                            collCourseEquivalenciessRelatedByCourseid = CourseEquivalenciesPeer.doSelectJoinCourseRelatedByCourseequivalencies(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseEquivalenciesPeer.COURSEID, getCourseid());
                        if (!lastCourseEquivalenciessRelatedByCourseidCriteria.equals(criteria))
            {
                collCourseEquivalenciessRelatedByCourseid = CourseEquivalenciesPeer.doSelectJoinCourseRelatedByCourseequivalencies(criteria);
            }
        }
        lastCourseEquivalenciessRelatedByCourseidCriteria = criteria;

        return collCourseEquivalenciessRelatedByCourseid;
    }
                            


                                  
            
    /**
     * Collection to store aggregation of collCourseEquivalenciessRelatedByCourseequivalencies
     */
    protected List collCourseEquivalenciessRelatedByCourseequivalencies;

    /**
     * Temporary storage of collCourseEquivalenciessRelatedByCourseequivalencies to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initCourseEquivalenciessRelatedByCourseequivalencies()
    {
        if (collCourseEquivalenciessRelatedByCourseequivalencies == null)
        {
            collCourseEquivalenciessRelatedByCourseequivalencies = new ArrayList();
        }
    }

    /**
     * Method called to associate a CourseEquivalencies object to this object
     * through the CourseEquivalencies foreign key attribute
     *
     * @param l CourseEquivalencies
     * @throws TorqueException
     */
    public void addCourseEquivalenciesRelatedByCourseequivalencies(CourseEquivalencies l) throws TorqueException
    {
        getCourseEquivalenciessRelatedByCourseequivalencies().add(l);
        l.setCourseRelatedByCourseequivalencies((Course) this);
    }

    /**
     * The criteria used to select the current contents of collCourseEquivalenciessRelatedByCourseequivalencies
     */
    private Criteria lastCourseEquivalenciessRelatedByCourseequivalenciesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseEquivalenciessRelatedByCourseequivalencies(new Criteria())
     *
     * @throws TorqueException
     */
    public List getCourseEquivalenciessRelatedByCourseequivalencies() throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseequivalencies == null)
        {
            collCourseEquivalenciessRelatedByCourseequivalencies = getCourseEquivalenciessRelatedByCourseequivalencies(new Criteria(10));
        }
        return collCourseEquivalenciessRelatedByCourseequivalencies;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseEquivalenciessRelatedByCourseequivalencies from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getCourseEquivalenciessRelatedByCourseequivalencies(Criteria criteria) throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseequivalencies == null)
        {
            if (isNew())
            {
               collCourseEquivalenciessRelatedByCourseequivalencies = new ArrayList();
            }
            else
            {
                      criteria.add(CourseEquivalenciesPeer.COURSEEQUIVALENCIES, getCourseid() );
                      collCourseEquivalenciessRelatedByCourseequivalencies = CourseEquivalenciesPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(CourseEquivalenciesPeer.COURSEEQUIVALENCIES, getCourseid());
                      if (!lastCourseEquivalenciessRelatedByCourseequivalenciesCriteria.equals(criteria))
                {
                    collCourseEquivalenciessRelatedByCourseequivalencies = CourseEquivalenciesPeer.doSelect(criteria);
                }
            }
        }
        lastCourseEquivalenciessRelatedByCourseequivalenciesCriteria = criteria;

        return collCourseEquivalenciessRelatedByCourseequivalencies;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getCourseEquivalenciessRelatedByCourseequivalencies(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseEquivalenciessRelatedByCourseequivalencies(Connection con) throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseequivalencies == null)
        {
            collCourseEquivalenciessRelatedByCourseequivalencies = getCourseEquivalenciessRelatedByCourseequivalencies(new Criteria(10), con);
        }
        return collCourseEquivalenciessRelatedByCourseequivalencies;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related CourseEquivalenciessRelatedByCourseequivalencies from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getCourseEquivalenciessRelatedByCourseequivalencies(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseequivalencies == null)
        {
            if (isNew())
            {
               collCourseEquivalenciessRelatedByCourseequivalencies = new ArrayList();
            }
            else
            {
                       criteria.add(CourseEquivalenciesPeer.COURSEEQUIVALENCIES, getCourseid());
                       collCourseEquivalenciessRelatedByCourseequivalencies = CourseEquivalenciesPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(CourseEquivalenciesPeer.COURSEEQUIVALENCIES, getCourseid());
                       if (!lastCourseEquivalenciessRelatedByCourseequivalenciesCriteria.equals(criteria))
                 {
                     collCourseEquivalenciessRelatedByCourseequivalencies = CourseEquivalenciesPeer.doSelect(criteria, con);
                 }
             }
         }
         lastCourseEquivalenciessRelatedByCourseequivalenciesCriteria = criteria;

         return collCourseEquivalenciessRelatedByCourseequivalencies;
     }

                        
              
                    
                              
                                            
                                                                          
                                        
                    
                                
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related CourseEquivalenciessRelatedByCourseequivalencies from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getCourseEquivalenciessRelatedByCourseequivalenciesJoinCourseRelatedByCourseid(Criteria criteria)
        throws TorqueException
    {
        if (collCourseEquivalenciessRelatedByCourseequivalencies == null)
        {
            if (isNew())
            {
               collCourseEquivalenciessRelatedByCourseequivalencies = new ArrayList();
            }
            else
            {
                            criteria.add(CourseEquivalenciesPeer.COURSEEQUIVALENCIES, getCourseid());
                            collCourseEquivalenciessRelatedByCourseequivalencies = CourseEquivalenciesPeer.doSelectJoinCourseRelatedByCourseid(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(CourseEquivalenciesPeer.COURSEEQUIVALENCIES, getCourseid());
                        if (!lastCourseEquivalenciessRelatedByCourseequivalenciesCriteria.equals(criteria))
            {
                collCourseEquivalenciessRelatedByCourseequivalencies = CourseEquivalenciesPeer.doSelectJoinCourseRelatedByCourseid(criteria);
            }
        }
        lastCourseEquivalenciessRelatedByCourseequivalenciesCriteria = criteria;

        return collCourseEquivalenciessRelatedByCourseequivalencies;
    }
                  
                    
                              
                                            
                                                                          
                                        
                    
                                            
                            


                          
            
    /**
     * Collection to store aggregation of collGrades
     */
    protected List collGrades;

    /**
     * Temporary storage of collGrades to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initGrades()
    {
        if (collGrades == null)
        {
            collGrades = new ArrayList();
        }
    }

    /**
     * Method called to associate a Grade object to this object
     * through the Grade foreign key attribute
     *
     * @param l Grade
     * @throws TorqueException
     */
    public void addGrade(Grade l) throws TorqueException
    {
        getGrades().add(l);
        l.setCourse((Course) this);
    }

    /**
     * The criteria used to select the current contents of collGrades
     */
    private Criteria lastGradesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getGrades(new Criteria())
     *
     * @throws TorqueException
     */
    public List getGrades() throws TorqueException
    {
        if (collGrades == null)
        {
            collGrades = getGrades(new Criteria(10));
        }
        return collGrades;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related Grades from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getGrades(Criteria criteria) throws TorqueException
    {
        if (collGrades == null)
        {
            if (isNew())
            {
               collGrades = new ArrayList();
            }
            else
            {
                      criteria.add(GradePeer.COURSEID, getCourseid() );
                      collGrades = GradePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(GradePeer.COURSEID, getCourseid());
                      if (!lastGradesCriteria.equals(criteria))
                {
                    collGrades = GradePeer.doSelect(criteria);
                }
            }
        }
        lastGradesCriteria = criteria;

        return collGrades;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getGrades(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getGrades(Connection con) throws TorqueException
    {
        if (collGrades == null)
        {
            collGrades = getGrades(new Criteria(10), con);
        }
        return collGrades;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related Grades from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getGrades(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collGrades == null)
        {
            if (isNew())
            {
               collGrades = new ArrayList();
            }
            else
            {
                       criteria.add(GradePeer.COURSEID, getCourseid());
                       collGrades = GradePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(GradePeer.COURSEID, getCourseid());
                       if (!lastGradesCriteria.equals(criteria))
                 {
                     collGrades = GradePeer.doSelect(criteria, con);
                 }
             }
         }
         lastGradesCriteria = criteria;

         return collGrades;
     }

                        
              
                    
                    
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related Grades from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getGradesJoinStudent(Criteria criteria)
        throws TorqueException
    {
        if (collGrades == null)
        {
            if (isNew())
            {
               collGrades = new ArrayList();
            }
            else
            {
                            criteria.add(GradePeer.COURSEID, getCourseid());
                            collGrades = GradePeer.doSelectJoinStudent(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(GradePeer.COURSEID, getCourseid());
                        if (!lastGradesCriteria.equals(criteria))
            {
                collGrades = GradePeer.doSelectJoinStudent(criteria);
            }
        }
        lastGradesCriteria = criteria;

        return collGrades;
    }
                  
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related Grades from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getGradesJoinCourse(Criteria criteria)
        throws TorqueException
    {
        if (collGrades == null)
        {
            if (isNew())
            {
               collGrades = new ArrayList();
            }
            else
            {
                            criteria.add(GradePeer.COURSEID, getCourseid());
                            collGrades = GradePeer.doSelectJoinCourse(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(GradePeer.COURSEID, getCourseid());
                        if (!lastGradesCriteria.equals(criteria))
            {
                collGrades = GradePeer.doSelectJoinCourse(criteria);
            }
        }
        lastGradesCriteria = criteria;

        return collGrades;
    }
                            


                          
            
    /**
     * Collection to store aggregation of collSections
     */
    protected List collSections;

    /**
     * Temporary storage of collSections to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initSections()
    {
        if (collSections == null)
        {
            collSections = new ArrayList();
        }
    }

    /**
     * Method called to associate a Section object to this object
     * through the Section foreign key attribute
     *
     * @param l Section
     * @throws TorqueException
     */
    public void addSection(Section l) throws TorqueException
    {
        getSections().add(l);
        l.setCourse((Course) this);
    }

    /**
     * The criteria used to select the current contents of collSections
     */
    private Criteria lastSectionsCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getSections(new Criteria())
     *
     * @throws TorqueException
     */
    public List getSections() throws TorqueException
    {
        if (collSections == null)
        {
            collSections = getSections(new Criteria(10));
        }
        return collSections;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related Sections from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getSections(Criteria criteria) throws TorqueException
    {
        if (collSections == null)
        {
            if (isNew())
            {
               collSections = new ArrayList();
            }
            else
            {
                      criteria.add(SectionPeer.COURSEID, getCourseid() );
                      collSections = SectionPeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                      criteria.add(SectionPeer.COURSEID, getCourseid());
                      if (!lastSectionsCriteria.equals(criteria))
                {
                    collSections = SectionPeer.doSelect(criteria);
                }
            }
        }
        lastSectionsCriteria = criteria;

        return collSections;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getSections(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getSections(Connection con) throws TorqueException
    {
        if (collSections == null)
        {
            collSections = getSections(new Criteria(10), con);
        }
        return collSections;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course has previously
     * been saved, it will retrieve related Sections from storage.
     * If this Course is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getSections(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collSections == null)
        {
            if (isNew())
            {
               collSections = new ArrayList();
            }
            else
            {
                       criteria.add(SectionPeer.COURSEID, getCourseid());
                       collSections = SectionPeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                       criteria.add(SectionPeer.COURSEID, getCourseid());
                       if (!lastSectionsCriteria.equals(criteria))
                 {
                     collSections = SectionPeer.doSelect(criteria, con);
                 }
             }
         }
         lastSectionsCriteria = criteria;

         return collSections;
     }

                  
              
                    
                              
                                
                                                              
                                        
                    
                    
          
    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Course is new, it will return
     * an empty collection; or if this Course has previously
     * been saved, it will retrieve related Sections from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Course.
     */
    protected List getSectionsJoinCourse(Criteria criteria)
        throws TorqueException
    {
        if (collSections == null)
        {
            if (isNew())
            {
               collSections = new ArrayList();
            }
            else
            {
                            criteria.add(SectionPeer.COURSEID, getCourseid());
                            collSections = SectionPeer.doSelectJoinCourse(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            boolean newCriteria = true;
                        criteria.add(SectionPeer.COURSEID, getCourseid());
                        if (!lastSectionsCriteria.equals(criteria))
            {
                collSections = SectionPeer.doSelectJoinCourse(criteria);
            }
        }
        lastSectionsCriteria = criteria;

        return collSections;
    }
                            


          
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
              fieldNames.add("Courseid");
              fieldNames.add("Coursecode");
              fieldNames.add("Coursename");
              fieldNames.add("Coursedescription");
              fieldNames.add("Credit");
              fieldNames.add("Type");
              fieldNames.add("Coursestatus");
              fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
          if (name.equals("Courseid"))
        {
                return new Integer(getCourseid());
            }
          if (name.equals("Coursecode"))
        {
                return getCoursecode();
            }
          if (name.equals("Coursename"))
        {
                return getCoursename();
            }
          if (name.equals("Coursedescription"))
        {
                return getCoursedescription();
            }
          if (name.equals("Credit"))
        {
                return new Integer(getCredit());
            }
          if (name.equals("Type"))
        {
                return getType();
            }
          if (name.equals("Coursestatus"))
        {
                return new Integer(getCoursestatus());
            }
          return null;
    }
    
    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
          if (name.equals(CoursePeer.COURSEID))
        {
                return new Integer(getCourseid());
            }
          if (name.equals(CoursePeer.COURSECODE))
        {
                return getCoursecode();
            }
          if (name.equals(CoursePeer.COURSENAME))
        {
                return getCoursename();
            }
          if (name.equals(CoursePeer.COURSEDESCRIPTION))
        {
                return getCoursedescription();
            }
          if (name.equals(CoursePeer.CREDIT))
        {
                return new Integer(getCredit());
            }
          if (name.equals(CoursePeer.TYPE))
        {
                return getType();
            }
          if (name.equals(CoursePeer.COURSESTATUS))
        {
                return new Integer(getCoursestatus());
            }
          return null;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
            if (pos == 0)
        {
                return new Integer(getCourseid());
            }
              if (pos == 1)
        {
                return getCoursecode();
            }
              if (pos == 2)
        {
                return getCoursename();
            }
              if (pos == 3)
        {
                return getCoursedescription();
            }
              if (pos == 4)
        {
                return new Integer(getCredit());
            }
              if (pos == 5)
        {
                return getType();
            }
              if (pos == 6)
        {
                return new Integer(getCoursestatus());
            }
              return null;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
          save(CoursePeer.getMapBuilder()
                .getDatabaseMap().getName());
      }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
       * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
       *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
          try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
      }

      /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
      /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
          if (!alreadyInSave)
        {
            alreadyInSave = true;


  
            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    CoursePeer.doInsert((Course) this, con);
                    setNew(false);
                }
                else
                {
                    CoursePeer.doUpdate((Course) this, con);
                }
            }

                                      
                
            if (collCourseSemesterOffereds != null)
            {
                for (int i = 0; i < collCourseSemesterOffereds.size(); i++)
                {
                    ((CourseSemesterOffered) collCourseSemesterOffereds.get(i)).save(con);
                }
            }
                                          
                
            if (collCourseRgepDomains != null)
            {
                for (int i = 0; i < collCourseRgepDomains.size(); i++)
                {
                    ((CourseRgepDomain) collCourseRgepDomains.get(i)).save(con);
                }
            }
                                          
                
            if (collCourseLectures != null)
            {
                for (int i = 0; i < collCourseLectures.size(); i++)
                {
                    ((CourseLecture) collCourseLectures.get(i)).save(con);
                }
            }
                                          
                
            if (collCourseLaboratorys != null)
            {
                for (int i = 0; i < collCourseLaboratorys.size(); i++)
                {
                    ((CourseLaboratory) collCourseLaboratorys.get(i)).save(con);
                }
            }
                                          
                
            if (collCourseOfferingUnits != null)
            {
                for (int i = 0; i < collCourseOfferingUnits.size(); i++)
                {
                    ((CourseOfferingUnit) collCourseOfferingUnits.get(i)).save(con);
                }
            }
                                                    
                
            if (collCourseEquivalenciessRelatedByCourseid != null)
            {
                for (int i = 0; i < collCourseEquivalenciessRelatedByCourseid.size(); i++)
                {
                    ((CourseEquivalencies) collCourseEquivalenciessRelatedByCourseid.get(i)).save(con);
                }
            }
                                                    
                
            if (collCourseEquivalenciessRelatedByCourseequivalencies != null)
            {
                for (int i = 0; i < collCourseEquivalenciessRelatedByCourseequivalencies.size(); i++)
                {
                    ((CourseEquivalencies) collCourseEquivalenciessRelatedByCourseequivalencies.get(i)).save(con);
                }
            }
                                          
                
            if (collGrades != null)
            {
                for (int i = 0; i < collGrades.size(); i++)
                {
                    ((Grade) collGrades.get(i)).save(con);
                }
            }
                                          
                
            if (collSections != null)
            {
                for (int i = 0; i < collSections.size(); i++)
                {
                    ((Section) collSections.get(i)).save(con);
                }
            }
                          alreadyInSave = false;
        }
      }


                          
      /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param  courseid ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
            setCourseid(((NumberKey) key).intValue());
        }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
            setCourseid(Integer.parseInt(key));
        }

  
    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
          return SimpleKey.keyFor(getCourseid());
      }

 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
       * It then fills all the association collections and sets the
     * related objects to isNew=true.
       */
      public Course copy() throws TorqueException
    {
        return copyInto(new Course());
    }
  
    protected Course copyInto(Course copyObj) throws TorqueException
    {
          copyObj.setCourseid(courseid);
          copyObj.setCoursecode(coursecode);
          copyObj.setCoursename(coursename);
          copyObj.setCoursedescription(coursedescription);
          copyObj.setCredit(credit);
          copyObj.setType(type);
          copyObj.setCoursestatus(coursestatus);
  
                    copyObj.setCourseid(0);
                                                
                                      
                
        List v = getCourseSemesterOffereds();
        for (int i = 0; i < v.size(); i++)
        {
            CourseSemesterOffered obj = (CourseSemesterOffered) v.get(i);
            copyObj.addCourseSemesterOffered(obj.copy());
        }
                                                  
                
        v = getCourseRgepDomains();
        for (int i = 0; i < v.size(); i++)
        {
            CourseRgepDomain obj = (CourseRgepDomain) v.get(i);
            copyObj.addCourseRgepDomain(obj.copy());
        }
                                                  
                
        v = getCourseLectures();
        for (int i = 0; i < v.size(); i++)
        {
            CourseLecture obj = (CourseLecture) v.get(i);
            copyObj.addCourseLecture(obj.copy());
        }
                                                  
                
        v = getCourseLaboratorys();
        for (int i = 0; i < v.size(); i++)
        {
            CourseLaboratory obj = (CourseLaboratory) v.get(i);
            copyObj.addCourseLaboratory(obj.copy());
        }
                                                  
                
        v = getCourseOfferingUnits();
        for (int i = 0; i < v.size(); i++)
        {
            CourseOfferingUnit obj = (CourseOfferingUnit) v.get(i);
            copyObj.addCourseOfferingUnit(obj.copy());
        }
                                                            
                
        v = getCourseEquivalenciessRelatedByCourseid();
        for (int i = 0; i < v.size(); i++)
        {
            CourseEquivalencies obj = (CourseEquivalencies) v.get(i);
            copyObj.addCourseEquivalenciesRelatedByCourseid(obj.copy());
        }
                                                            
                
        v = getCourseEquivalenciessRelatedByCourseequivalencies();
        for (int i = 0; i < v.size(); i++)
        {
            CourseEquivalencies obj = (CourseEquivalencies) v.get(i);
            copyObj.addCourseEquivalenciesRelatedByCourseequivalencies(obj.copy());
        }
                                                  
                
        v = getGrades();
        for (int i = 0; i < v.size(); i++)
        {
            Grade obj = (Grade) v.get(i);
            copyObj.addGrade(obj.copy());
        }
                                                  
                
        v = getSections();
        for (int i = 0; i < v.size(); i++)
        {
            Section obj = (Section) v.get(i);
            copyObj.addSection(obj.copy());
        }
                    
        return copyObj;
    }

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public CoursePeer getPeer()
    {
        return peer;
    }

    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Course:\n");
        str.append("Courseid = ")
           .append(getCourseid())
           .append("\n");
        str.append("Coursecode = ")
           .append(getCoursecode())
           .append("\n");
        str.append("Coursename = ")
           .append(getCoursename())
           .append("\n");
        str.append("Coursedescription = ")
           .append(getCoursedescription())
           .append("\n");
        str.append("Credit = ")
           .append(getCredit())
           .append("\n");
        str.append("Type = ")
           .append(getType())
           .append("\n");
        str.append("Coursestatus = ")
           .append(getCoursestatus())
           .append("\n");
        return(str.toString());
    }
}
